// StandardSet.cpp: implementation of the StandardSet class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "Phsshare.h"
#include "StandardSet.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

StandardSet::StandardSet()
{

}

StandardSet::~StandardSet()
{
	Close();
}

StandardInfo* StandardSet::GetFirst()
{
	try
	{
		if(m_rs == NULL)
			return NULL;
		m_rs->MoveFirst();
		
		return ReadStandardInfo();
	}
	CATCH_COM_ERROR(m_rs, NULL)
}

StandardInfo* StandardSet::GetNext()
{
	try
	{
		if(m_rs == NULL)
			return NULL;
		m_rs->MoveNext();
		
		return ReadStandardInfo();
	}
	CATCH_COM_ERROR(m_rs, NULL)
}

StandardInfo* StandardSet::ReadStandardInfo()
{
	if(m_rs->adoEOF || m_rs->BOF)
		return NULL;

	StandardInfo* pInfo = new StandardInfo;

	pInfo->StandardID(vtos(m_rs->GetCollect(_T("StandardID"))));
	pInfo->StandardPath(m_strDataPath);
	pInfo->StandardInfoTable(vtos(m_rs->GetCollect(_T("StandardInfoTable"))));
	pInfo->StandardStyle(vtoi(m_rs->GetCollect(_T("StandardStyle"))));

	return pInfo;
}